#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read<int>()
#define lin read<ll>()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

template <typename T>
T read(){
	T x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 5e5+10;
const int mod = 1e9+7;

int L[N<<2],R[N<<2],blo[N<<2],LL[N<<2],RR[N<<2],low[N<<2],dfn[N<<2],siz[N<<2],n,ind[N],tim,stk[N<<2],top,scc,to[N<<2],maxnode;
vector<int> G[N<<2],T[N<<2];
bool vis[N<<2],vv[N<<2];
ll ans,x[N],r[N];

void build(int o = 1,int l = 1,int r = n){
	L[o] = l,R[o] = r; maxnode = max(maxnode,o);
	if(l == r) return ind[l] = o,void();
	int mid = l+r>>1;
	build(o<<1,l,mid); build(o<<1|1,mid+1,r);
	G[o].pb(o<<1); G[o].pb(o<<1|1);
}

void upd(int xl,int xr,int fro,int o = 1,int l = 1,int r = n){
	if(xl == l && xr == r) {if(fro != o) G[fro].pb(o); return;}
	int mid = l+r>>1; if(xr <= mid) upd(xl,xr,fro,o<<1,l,mid);
	else if(xl > mid) upd(xl,xr,fro,o<<1|1,mid+1,r);
	else upd(xl,mid,fro,o<<1,l,mid),upd(mid+1,xr,fro,o<<1|1,mid+1,r);
}

void dfs(int x){
	vis[x] = 1; low[x] = dfn[x] = ++tim; stk[++top] = x;
	for(int y : G[x]){
		if(!low[y]) dfs(y),low[x] = min(low[x],low[y]);
		else if(vis[y]) low[x] = min(low[x],dfn[y]);
	}
	if(dfn[x] == low[x]){
		++scc;int y; LL[scc] = n+1;
		do{
			y = stk[top--]; vis[y] = 0;
			blo[y] = scc; LL[scc] = min(LL[scc],L[y]); RR[scc] = max(RR[scc],R[y]);
		}while(y != x);
	}
}

void Dfs(int x){
	if(vv[x]) return; vv[x] = 1;
	for(int y : T[x]){
		Dfs(y);
		LL[x] = min(LL[x],LL[y]);
		RR[x] = max(RR[x],RR[y]);
	}
}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in;
	for(int i = 1;i <= n;i++) x[i] = lin,r[i] = lin;
	build(); x[n+1] = 1e18;
	for(int i = 1;i <= n;i++){
		int L = lower_bound(x+1,x+n+1,x[i] - r[i]) - x;
		int R = upper_bound(x+1,x+n+1,x[i] + r[i]) - x - 1;
		upd(L,R,ind[i]);
	}
	dfs(1);
	for(int x = 1;x <= maxnode;x++){
		for(int y : G[x]){
			if(blo[x] != blo[y]) T[blo[x]].pb(blo[y]);
		}
	}
	for(int i = 1;i <= scc;i++){
		sort(T[i].begin(),T[i].end());
		T[i].resize(unique(T[i].begin(),T[i].end()) - T[i].begin());
	}
	for(int i = 1;i <= scc;i++) Dfs(i);
	for(int i = 1;i <= n;i++){
		int L = LL[blo[ind[i]]],R = RR[blo[ind[i]]];
		ans += 1ll * (R - L + 1) * i % mod ; ans %= mod;
	}
	printf("%lld\n",ans);
	return 0;
}
